<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    request.setAttribute("basePath", basePath);
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/tags" prefix="date"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>部门管理页面</title>


    <link href="houtai/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="houtai/font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <!-- Morris -->
    <link href="houtai/css/plugins/morris/morris-0.4.3.min.css" rel="stylesheet">
    <!-- Gritter -->
    <link href="houtai/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
    <link href="houtai/css/animate.css" rel="stylesheet">
    <link href="houtai/css/style.css" rel="stylesheet">
    <link href="houtai/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <link href="houtai/css/article.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element"> <span>
                            <img alt="image" class="img-circle" src="houtai/img/profile_small.jpg"/>
                             </span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="index.html#">
                                <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">${sessionUsername}</strong>
                             </span>  <span class="text-muted text-xs block" >${sessionTitle}<b class="caret"></b></span> </span>
                        </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li class="divider"></li>
                            <li><a href="remove">安全退出</a>
                            </li>
                        </ul>
                    </div>
                    <div class="logo-element">
                        ${sessionUsername}
                    </div>

                </li>
                <li class="active" id="first">
                    <a href="index.do" style="border-left: 0px"><i class="fa fa-desktop"></i>主页 </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa fa-globe"></i> <span class="nav-label">文章管理</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="getArticleList.do">文章列表</a>
                        </li>
                        <li><a href="getClassifyList.do">文章分类列表</a>
                        </li>
                    </ul>
                </li>

                <li>
                    <a href="#"><i class="fa fa fa-globe"></i> <span class="nav-label">订单管理</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="getOrders">订单列表</a>
                        </li>
                        <li><a href="getDetails">流水列表</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa fa-globe"></i> <span class="nav-label">项目管理</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="getProjectList">项目列表</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa fa-globe"></i> <span class="nav-label">车辆类型管理</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="getTypesList">车辆类型列表</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-flask"></i> <span class="nav-label">管理员设置</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="getMembersList.do">管理员列表</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-flask"></i> <span class="nav-label">系统管理</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="authGroupList.do">角色管理</a>
                        </li>
                        <li><a href="modulesList.do">模块管理</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>

    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top"   style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    <form   class="navbar-form-custom" method="post" action="search_results.html">
                        <div class="form-group">
                            <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
                        </div>
                    </form>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <span class="m-r-sm text-muted welcome-message"><a href="index.html" title="返回首页"><i class="fa fa-home"></i></a>安全隐患管理系统欢迎您</span>
                    </li>

                    <li>
                        <a href="remove">
                            <i class="fa fa-sign-out"></i> 退出
                        </a>
                    </li>
                </ul>

            </nav>
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>企业管理界面</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="index.do">主页</a>
                    </li>
                    <li>
                        <strong>企业列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">
            </div>
        </div>
        <div class="wrapper wrapper-content">
            <div class="wrapper wrapper-content">
                <div class="row">
                    <div class="col-lg-12">
                        <form action="getCompanyList.do" method="get">
                            <table class="table table-bordered">
                                <tr>
                                    <td align="center" bgcolor="#f1f1f1">公司信息</td>
                                    <td align="center"><input type="text" name="companyName"  value="${requestScope.companyName}"></td>
                                    <td align="center" bgcolor="#f1f1f1">法人姓名</td>
                                    <td align="center"><input type="text" name="legalPerson"  value="${requestScope.legalPerson}"></td>
                                    <td align="center" bgcolor="#f1f1f1">法人手机号</td>
                                    <td align="center"><input type="text" name="phone"  value="${requestScope.phone}"></td>
                                    <td align="right">
                                        <input type="submit" value="点击查询" class="btn btn-primary"/>
                                    </td>
                                    <td align="center">
                                        <button type="button" class="btn btn-primary" data-toggle="modal"
                                                data-target="#insertModal">添加企业</button>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            <div class="row">
                <div class="col-lg-12">
                    <table class="table table-bordered table-striped table-hover">
                        <tbody>
                        <tr align="center">
                            <td nowrap="nowrap"><strong>序号</strong></td>
                            <td><strong>企业名称</strong></td>
                            <td><strong>法人信息</strong></td>
                            <td><strong>法人手机</strong></td>
                            <td><strong>创建人员</strong></td>
                            <td><strong>备注</strong></td>
                            <td><strong>创建时间</strong></td>
                            <td><strong>状态</strong></td>
                            <td width="40"><strong> 操作 </strong></td>
                        </tr>
                        <c:forEach items="${companyList}" var="t" varStatus="s">
                            <tr align="center" class="tr">
                                <td>${s.count}</td>
                                <td class="hiddenTD">${t.id}</td>
                                <td>${t.companyName}</td>
                                <td>${t.legalPerson}</td>
                                <td>${t.phone}</td>
                                <td>${t.managerName}</td>
                                <td>${t.beizhu}</td>
                                <td class="hiddenTD">${t.img}</td>
                                <td class="hiddenTD">${t.content}</td>
                                <td class="hiddenTD">${t.status}</td>
                                <td class="hiddenTD">${t.username}</td>
                                <td><date:date value="${t.createTime*1000}"></date:date></td>
                                <td>
                                    <c:if test="${t.status==1}">
                                    <button class="btn btn-info btn-circle juzhong" type="button"><i class="fa fa-check"></i></button>
                                    </c:if> <c:if test="${t.status==0}">
                                    <button class="btn btn-warning btn-circle juzhong" type="button"><i class="fa fa-times"></i></button>
                                    </c:if>
                                </td>
                                <td class="hiddenTD">${t.status}</td>
                                <td>
                                    <div class="btn-group btn-group-xs">
                                        <button type="button" class="btn btn-w-m btn-warning"  data-toggle="modal" data-target="#Modal" onclick="update(this)">编辑企业信息</button>
                                        <button type="button" class="btn btn-w-m btn-success"   data-toggle="modal" data-target="#updatePassword" onclick="updatePassword(this)">修改密码</button>
                                        <button type="button" class="btn btn-w-m btn-primary"   data-toggle="modal" data-target="#Modal1" onclick="readCompanyMessage(this)">企业信息</button>
                                        <button type="button" class="btn btn-w-m btn-success"   onclick="updatePassword(this)">查看企业任务</button>
                                        <button type="button" class="btn btn-w-m btn-danger" data-toggle="modal" data-target="#myModal6" onclick="remove(this)">删除企业</button>

                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        <tr>
                            <td colspan='18'>
                                <div align="center"><ul class='pagination'>
                                    <li><span>共 ${page.totalCount} 条记录<span class="sr-only"></span></span></li></ul>
                                </div>
                                <div align="center">
                                    <font size="2">共 ${page.pagenow}/${page.pageCount} 页</font>
                                    <c:choose>
                                        <c:when test="${page.pagenow == 1}">
                                            <span>首页</span>
                                        </c:when>
                                        <c:otherwise >
                                            <a href="getCompanyList.do?pageNow=1&companyName=${companyName}&legalPerson=${legalPerson}&phone=${phone}">首页</a>
                                        </c:otherwise>
                                    </c:choose>
                                    <c:choose>
                                        <c:when test="${page.pagenow > 1}">
                                            <a href="getCompanyList.do?pageNow=${page.pagenow - 1}&companyName=${companyName}&legalPerson=${legalPerson}&phone=${phone}">上一页</a>
                                        </c:when>
                                        <c:otherwise >
                                            <span>上一页</span>
                                        </c:otherwise>
                                    </c:choose>
                                    <c:choose>
                                        <c:when test="${page.pagenow < page.pageCount}">
                                            <a href="getCompanyList.do?pageNow=${page.pagenow + 1}&companyName=${companyName}&legalPerson=${legalPerson}&phone=${phone}">下一页</a>
                                        </c:when>
                                        <c:otherwise>
                                            <span>下一页</span>
                                        </c:otherwise>
                                    </c:choose>
                                    <c:choose>
                                        <c:when test="${page.pagenow==page.pageCount}">
                                            <span>尾页</span>
                                        </c:when>
                                        <c:otherwise>
                                            <a href="getCompanyList.do?pageNow=${page.pageCount}&companyName=${companyName}&legalPerson=${legalPerson}&phone=${phone}">尾页</a>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                            </td></tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="footer">
            <div class="pull-right">
                By：<a href="http://www.zi-han.net" target="_blank">zihan's blog</a>
            </div>
            <div>
                <strong>Copyright</strong> H+ &copy; 2014
            </div>
        </div>
    </div>
</div>
    <!-----------------------------------------------------查看描述------------------------------------------------------------------>
    <div class="modal inmodal" id="Modal1" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content animated flipInY">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span>×</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">企业详情</h4>
                </div>
                <div class="modal-body">
                    <div class="row form-body form-horizontal m-t" id="read" align="center">
                    </div>
                    <div class="modal-footer">
                        <button class="btn btn-info" data-dismiss="modal"  >关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-----------------------------------------------------添加分类模拟窗口------------------------------------------------------------------>
    <div class="modal inmodal fade" id="insertModal" z-index:-1>
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span>×</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">企业信息</h4>
                    <small class="font-bold">添加企业</small>
                </div>
                <div class="modal-body">
                    <form name="addForm" id="addForm" action="insertCompany.do" method='post' onsubmit="javascript:return checkMessage()">

                        <div class="row form-body form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业名称：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="companyName" id="insertCompanyName"  class="form-control dm-name"
                                           placeholder="请输入企业名称" required="required">
                                    <span class="dm-span"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">法人代表：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="legalPerson"  class="form-control dm-name"
                                           placeholder="请输入法人代表" required="required">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">法人手机号：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="phone"  class="form-control dm-name"
                                           placeholder="请输入法人手机号" required="required">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业端登录账号：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="username"  id="insert_username" class="form-control dm-name"
                                           placeholder="请输入企业端登录账号" required="required" maxlength="30" minlength="6">
                                    <span class="dm-span"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业端登录密码：</label>
                                <div class="col-sm-9 cc">
                                    <input type="password" name="password" id="password1"  class="form-control dm-name"
                                           placeholder="请输入企业端登录密码" required="required"  maxlength="16" minlength="8">
                                    <span class="dm-span"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">再次输入企业端登录密码：</label>
                                <div class="col-sm-9 cc">
                                    <input type="password" id="password2"  class="form-control dm-name"
                                           placeholder="请输入企业端登录确认密码" required="required" >
                                    <span class="dm-span"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">标注：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="beizhu"  class="form-control dm-name"
                                           placeholder="标注分为：优秀企业、违规企业，需整改企业" required="required">
                                    <span class="dm-span"><font color="red">标注分为：优秀企业、违规企业，需整改企业</font></span>
                                </div>
                            </div>

                            <%--图片上传插件--%>
                            <div class="s">
                                <div id="preview" align="center"></div>
                                <div id="div_img"><img  width="150px" height="150px"  src=""></div>
                                <div class="c">
                                    <input type="file" name="headPortraitFile" id="file_upload" value="" />
                                    <input type="hidden" id="file01" name="img"/>
                                    <a class="easyui-linkbutton gg" onclick="startUpload();" href="javascript:void(0);">开始上传</a>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业详情：<font color="red">*</font></label>
                                <div class="col-sm-9">
                                    <textarea class="content"   id="container" name="content"></textarea>
                                </div>
                            </div>

                            <div class="modal-footer">
                                <button type="submit"   class="btn btn-info" style="width:80px">增加</button>
                                <button class="btn" data-dismiss="modal"   style="width:80px">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-----------------------------------------------------修改企业模拟窗口------------------------------------------------------------------>
    <div class="modal inmodal fade" id="Modal" z-index:-1>
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span>×</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">企业信息</h4>
                    <small class="font-bold">修改企业</small>
                </div>
                <div class="modal-body">
                    <form name="addForm"   action="updateCompany.do" method='post'>
                        <input type="hidden" id="rid" name="id">
                        <div class="row form-body form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业名称：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="companyName" id="update_CompanyName"  class="form-control dm-name"
                                           placeholder="请输入企业名称" required="required">
                                    <span class="dm-span"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">法人代表：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="legalPerson" id="update_legalPerson"  class="form-control dm-name"
                                           placeholder="请输入法人代表" required="required">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">法人手机号：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="phone" id="update_phone"  class="form-control dm-name"
                                           placeholder="请输入法人手机号" required="required">
                                    <span class="dm-span"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">标注：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="beizhu" id="update_beizhu"  class="form-control dm-name"
                                           placeholder="标注分为：优秀企业、违规企业，需整改企业" required="required">
                                    <span class="dm-span"><font color="red">标注分为：优秀企业、违规企业，需整改企业</font></span>
                                </div>
                            </div>

                            <%--图片上传插件--%>
                            <div class="s">
                                <div id="preview1" align="center"></div>
                                <div id="div_img2"><img id="imgPre" width="150px" height="150px"  src=""></div>
                                <div class="c"><input type="file" name="headPortraitFile" id="file_upload1" value=""/>
                                    <input type="hidden" id="file02" name="img"/>
                                    <a class="easyui-linkbutton gg" onclick="startUpload1();" href="javascript:void(0);">开始上传</a></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">文章详情：<font color="red">*</font></label>
                                <div class="col-sm-9">
                                    <textarea   id="container1" name="content"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" >状态：
                                </label>

                                <div class="col-sm-9">
                                    <label class="radio-inline" >
                                        <input type="radio" value="1" id="a"   name="status">启用</label>
                                    <label class="radio-inline" >
                                        <input type="radio" value="0" id="b"   name="status">未启用</label>
                                </div>
                            </div>


                            <div class="modal-footer">
                                <button type="submit"   class="btn btn-info" style="width:80px">增加</button>
                                <button class="btn" data-dismiss="modal"   style="width:80px">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-----------------------------------------------------修改企业端账户密码模拟窗口------------------------------------------------------------------>
    <div class="modal inmodal fade" id="updatePassword" z-index:-1>
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span>×</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">企业端账户信息</h4>
                    <small class="font-bold">修改企业</small>
                </div>
                <div class="modal-body">
                    <form name="addForm"   action="updateCompanyPassword.do" method='post'>
                        <input type="hidden" id="vid" name="id">
                        <div class="row form-body form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业端登录账号：</label>
                                <div class="col-sm-9 cc">
                                    <input type="text" name="username"  id="update_username" class="form-control dm-name"
                                           placeholder="请输入企业端登录账号" required="required" readOnly>
                                    <span class="dm-span"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">企业端登录密码：</label>
                                <div class="col-sm-9 cc">
                                    <input type="password" name="password"   class="form-control dm-name"
                                           placeholder="请输入企业端登录密码"  maxlength="16" minlength="8">
                                    <span class="dm-span">不修改密码可以不做填写</span>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="submit"   class="btn btn-info" style="width:80px">修改</button>
                                <button class="btn" data-dismiss="modal"   style="width:80px">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<!-----------------------------------------------------删除分类模拟窗口------------------------------------------------------------------>
<div class="modal inmodal" id="myModal6" tabindex="-1"style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span>×</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">删除窗口</h4>
            </div>
            <form  action="deleteSection.do" method='get'>
                <div class="modal-body">
                    删除企业将同时和这个企业有关的账户数据、任务数据、检查记录数据和部门人员数据，并且不能恢复。您确定要删除吗？
                    <input type="hidden" name="id" id="deleteId">
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">删除</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">取消</button >
                </div>
            </form>
        </div>
    </div>
</div>
<!-----------------------------------------------------查询人员窗口------------------------------------------------------------------>
<div class="modal inmodal fade" id="EmpModal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span>×</span><span class="sr-only">Close</span>
                </button>
                <h4 class="modal-title">部门管理</h4>
                <small class="font-bold">查询部门人员</small>
            </div>
            <div class="modal-body">
                <table class="table table-bordered table-striped table-hover" id="section_emp_list">
                    <tbody>
                        <tr align="center">
                            <td><strong>序号</strong></td>
                            <td><strong>名字</strong></td>
                            <td><strong>手机号</strong></td>
                            <td><strong>性别</strong></td>
                            <td><strong>角色</strong></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</div>
<!-- Mainly scripts -->
<script src="houtai/Jquery/jquery-3.0.0.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="public/static/utf8-jsp/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="public/static/utf8-jsp/ueditor.all.js"></script>
<script type="text/javascript" src="houtai/My97DatePicker/My97DatePicker/WdatePicker.js"></script>
<script src="houtai/uploadify/jquery.uploadify.min.js"></script>
<script src="houtai/js/bootstrap.min.js?v=3.4.0"></script>
<script src="houtai/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="houtai/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="houtai/js/hplus.js?v=2.2.0"></script>
<script src="houtai/js/plugins/pace/pace.min.js"></script>
<script src="public/static/back/js/article.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
    var ue1 = UE.getEditor('container1');
    function checkMessage(){
        var companyName =$('#insertCompanyName').val();
        var username =$('#insert_username').val();
        var password1 =$('#password1').val();
        var password2 =$('#password2').val();
        if(checkCompanyNameExist(companyName)){
            $('#insertCompanyName').next().html("企业已经存在了");
              return false;
        }else{
            $('#insertCompanyName').next().html("");
        }
        if(password1!=password2){
            $('#password2').next().html("请核实两次输入的密码");
            return false;
        }else{
            $('#password2').next().html("");
        }
        if(checkCompanyUserNameExist(username)){
            $('#insert_username').next().html("企业端账号已经存在了");
            return false;
        }else{
            $('#insert_username').next().html("");
        }
        return true;
     }

    function checkCompanyNameExist(companyName){
        var flag=false;
        $.ajax({
            type : "get",
            url :  "checkCompanyName",
            data: {CompanyName:companyName},
            dataType: 'json',
            async:false,
            success:function (Result) {
                var result = Result.result;
                if(result==0){
                    flag=true;
                }else{
                    flag=false;
                }
            }
        });
        return flag;
    }
    function checkCompanyUserNameExist(username){
        var flag=false;
        $.ajax({
            type : "get",
            url :  "checkCompanyuserName",
            data: {username:username},
            dataType: 'json',
            async:false,
            success:function (Result) {
                var result = Result.result;
                if(result==0){
                    flag=true;
                }else{
                    flag=false;
                }
            }
        });
        return flag;
    }
   /* function checkUpdateMessage() {
        var companyName =$('#update_CompanyName').val();
        if(checkCompanyNameExist(companyName)){
            $('#update_CompanyName').next().html("企业已经存在了");
            return false;
        }else{
            $('#update_CompanyName').next().html("");
        }
        return true;
    }*/
</script>

</body>
</html>
</html>
